import 'package:flutter/material.dart';
import 'package:x3_component_core/x3_component_core.dart';
import 'package:x3_business_core/business_customer/ful_components/business_customer_details_coupons_item.dart';

class BusinessCustomerDetailsCouponsTab extends StatefulWidget {

  BusinessCustomerDetailsCouponsTab({Key key, @required this.vipId, @required this.couponState, @required this.inputApi}) : super(key: key);

  final String vipId;

  final String couponState;

  final String inputApi;

  @override
  _BusinessCustomerDetailsCouponsTabState createState() => _BusinessCustomerDetailsCouponsTabState();

}

class _BusinessCustomerDetailsCouponsTabState extends State<BusinessCustomerDetailsCouponsTab> with AutomaticKeepAliveClientMixin {

  @override
  Widget build(BuildContext context) {
    super.build(context);
    return BaseRefreshComponent(
      path: widget.inputApi,
      params: {'vipId': widget.vipId, 'couponState': widget.couponState, 'archiveState': '1' },
      buildItem: ( Map<String, dynamic> item, int index ) {
        return BaseCardComponent(
          child: BusinessCustomerDetailsCouponsItem( item: item, couponState: widget.couponState ),
        );
      },
      controller: new BaseRefreshController(),
    );
  }

  @override
  bool get wantKeepAlive => true;

}
